package com.project.yuepai.dao;

import com.project.yuepai.dto.UserBaseDto;
import com.project.yuepai.model.User;
import com.project.yuepai.model.UserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserBaseMapper {
    //增
    int insertNewUser(User user);
    //删
    int deleteByPrimaryId(String userId);
    //改
    int updateUserInfos(User user);
    //查
    User selectUserByPrimaryId(String userId);
    User selectUserByName(String username);
    User selectUserByPhone(String phone);
    User selectUserByEmail(String email);

    //用户根据邮箱设置新密码
    int updatePwdByEmail(@Param("email") String email, @Param("newPwd") String newPwd);
    //用户根据手机号设置新密码
    int updatePwdByPhone(@Param("phone") String phone, @Param("newPwd") String newPwd);

    //查找手机
    public User findRjuserByUserPhone(String userPhone);
    //查找邮箱
    public User findRjuserByUserEmail(String userEmail);

    List<User> findUsersByConditon(@Param("userRole") Integer userRole,@Param("nickName") String nickName,@Param("userPhone") String userPhone);

    UserRole findUserModel(String userId);

    UserRole findUserCameraman(String userId);

    UserBaseDto findUserBaseByPhone(String userPhone);

    UserBaseDto findUserBaseByEmail(String userEmail);



    int deleteUserModel(Integer roleId);
    int deleteModelOrder(Integer roleId);
    int deleteUserCameraman(Integer roleId);
    int deleteCameramanOrder(Integer roleId);


}
